#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include<QTcpServer>//用于建立TCP连接和传输数据
#include<QtNetwork>//此模块提供开发TCP/IP客户端和服务器的类
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private:
    Ui::MainWindow *ui;



private:
    QTcpServer *tcpserver;//TCP服务器
    QTcpSocket*tcpsocket;//TCP通讯socket
    QString GertLocalIpAddress();//获取本地地址
private slots:
    void clientdisconnect();
    void clientconnect();
    void newconnection();//接收连接，创建套件字
    void socketreaddata();//接收数据




    void on_pushButton_start_clicked();

    void on_pushButton_stop_clicked();

    void on_pushButton_send_clicked();

protected:
    void closeEvent(QCloseEvent*ev);



};
#endif // MAINWINDOW_H
